function Net = setNetPath(Net)
if ~isfield(Net, path) || isempty(Net.path)
    Net.model_folders = cellfun(@(path)getFullPath(path, @isdir), Net.model_folders, 'UniformOutput', false);
    Net.deploy_file = getFullPath(Net.deploy_file, @(x)exist(x, 'file'));
else
    Net.path = getFullPath(Net);
    Net.model_folders = cellfun(@(path)fullfile(Net.path, path), Net.model_folders, 'UniformOutput', false);
    Net.deploy_file = fullfile(Net.path, Net.deploy_file);
    Net = rmfield(Net, 'path');
end

function FullPath = getFullPath(SubPath, hexist)
FullPath = SubPath;
if hexist(FullPath), return; end

ResultPathList = {
    fullfile(srpath.getResultPath, 'a')
    '/home/wks/SR-Works/%result/a'
    };

for i = 1 : length(ResultPathList)
    ResultPath = ResultPathList{i};
    for cnt = 1 : 2
        if hexist(FullPath), return; end
        ResultPath = fileparts(ResultPath);
        FullPath = fullfile(ResultPath, SubPath);
    end
end

error('%s does not exist!', SubPath);
